﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "WidgetReszimg.h"

#include <CameraCtrl.h>
#include <MoveStage.h>
#include <QMainWindow>
#include <QMutex>
#include <QThread>
#include <QTimer>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
  Q_OBJECT

public:
  MainWindow(QWidget *parent = nullptr);
  ~MainWindow();

  void start_D_S_P_G();
  void LoadConfig();
  void saveConfig();

private slots:
void on_pushButton_clicked();

void on_pushButton_start_clicked();

void on_pushButton_go_clicked();

void on_pushButton_break_clicked();

void on_SpinBox_Exposure_editingFinished();

void on_SpinBox_gain_editingFinished();

void on_min_clicked();

void on_close_clicked();

void on_pushButton_open_folder_clicked();

private:
  Ui::MainWindow *ui;
   QList<cv::Mat> image_show_list_;
   QList<cv::Mat> image_move_save_list_;

  CameraCtrl  *camera;
  unsigned int ip1,ip2,ip3,ip4;
  MoveStage *move_stage;
  QString port;
  unsigned int flag;
  unsigned int step;
  unsigned int speed;
  bool move_finish =1;
  bool move_error = 0;
  bool isbreak =false;
  int times =0;
  int total_times =0;
  int delay =0;
  QMutex mutex_com;
  QMutex mutex_movefinish;
  QMutex mutex_times;
  QByteArray byte10;
  QString save_dir;
  QObject* cycle_move_worker =new QObject();
  QThread* cycle_move_thread = new QThread();
  WidgetReszImg *widgetReszImg =new WidgetReszImg() ;
signals:
  void getImage();


};
#endif // MAINWINDOW_H
